<template>
    <div>
        <h1>会员列表</h1>
        <table>
            <thead>
                <tr>
                    <td>等级编号</td>
                    <td>等级名称</td>
                    <td>密码</td>
                    <td>时间</td>
                    <td>等级状态</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody v-for="a in data">
                <tr>
                    <td>{{a.DId}}</td>
                    <td>{{a.Dname}}</td>
                    <td>{{a.Dmima}}</td>
                    <td>{{a.Dtime}}</td>
                    <td>{{a.Zhuangtai}}</td>
                    <td>
                        <input type="button" value="删除" @click="shan(a.DId)">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import axios from 'axios';
//model
const data=ref([
  {
    "DId": 0,
    "Dname": "",
    "Dmima": "",
    "Dtime": "",
    "Zhuangtai": true
  }
])
//删除信息数据

const shan=(val:any)=>{
    if(confirm("您确定要删除吗？"))
{
    

    axios.delete("https://localhost:7146/api/Basa/Shanchu",{params:{id:val}}).then(res=>{
        if(res.data>0)
    {
        alert("删除成功");
        getdate();
    }
    else
    {
        alert("删除失败了");
    }
    })
}
}


const getdate=()=>{axios.get
    ("https://localhost:7146/api/Basa/ShowDj").
    then(res=>{data.value=res.data})}
//文档就绪
onMounted(()=>{
    getdate();
})

</script>

<style scoped>

</style>